'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.createTable('users', { id: Sequelize.INTEGER });
    */
    const { INTEGER, STRING, DATE } = Sequelize;
    await queryInterface.createTable('admins', {
      admin_id: {
        type: INTEGER,
        autoIncrement: true,
        primaryKey: true,
        allowNull: false,
      },
      admin_name: {
        type: STRING(32),
        allowNull: false,
        unique: true,
      },
      password: {
        type: STRING(64),
        allowNull: false,
      },
      level: {
        type: STRING(32),
        allowNull: false,
      },
      phone: {
        type: STRING(16),
        allowNull: false,
      },
      created_at: {
        type: DATE,
        allowNull: false,
      },
      updated_at: {
        type: DATE,
        allowNull: false,
      },
    });
  },

  down: async (queryInterface, Sequelize) => {
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.dropTable('users');
    */
    console.log(Sequelize);
    await queryInterface.dropTable('admins');
  },
};
